{
 "cells": [
  {
   "cell_type": "raw",
   "metadata": {
    "raw_mimetype": "text/restructuredtext"
   },
   "source": [
    ".. _nb_mw:"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## MW\n",
    "\n",
    "MW <cite data-cite=\"mw\"></cite> is a constrained multi-objective test suite constructed in a similar fashion to CTP or WFG with 3 different distance functions and 3 local adjustment methods. Most problems are biobjective problems, except MW4, MW8 and MW14 which are scalable ($m \\geq 3$).\n",
    "\n",
    "They aim at replacing the CTP test suite by proposing more complex problems with up to 4 inequality constraints."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from pymoo.problems import get_problem\n",
    "from pymoo.util.plotting import plot\n",
    "from pymoo.problems import get_problem\n",
    "from pymoo.util.ref_dirs import get_reference_directions\n",
    "from pymoo.visualization.scatter import Scatter"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {
    "raw_mimetype": "text/restructuredtext"
   },
   "source": [
    ".. _nb_mw1:"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### MW1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "\n",
    "\n",
    "problem = get_problem(\"mw1\")\n",
    "plot(problem.pareto_front(), no_fill=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### MW2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "problem = get_problem(\"mw2\")\n",
    "plot(problem.pareto_front(), no_fill=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### MW3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "problem = get_problem(\"mw3\")\n",
    "plot(problem.pareto_front(), no_fill=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### MW4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "ref_dirs = get_reference_directions(\"das-dennis\", 3, n_partitions=12)\n",
    "pf = get_problem(\"mw4\").pareto_front(ref_dirs)\n",
    "Scatter(angle=(45,45)).add(pf, color=\"red\").show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### MW5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "problem = get_problem(\"mw5\")\n",
    "plot(problem.pareto_front(), no_fill=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### MW6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "problem = get_problem(\"mw6\")\n",
    "plot(problem.pareto_front(), no_fill=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### MW7"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "problem = get_problem(\"mw7\")\n",
    "plot(problem.pareto_front(), no_fill=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### MW8"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "ref_dirs = get_reference_directions(\"das-dennis\", 3, n_partitions=12)\n",
    "pf = get_problem(\"mw8\").pareto_front(ref_dirs)\n",
    "Scatter(angle=(45,45)).add(pf, color=\"red\").show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### MW9"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "problem = get_problem(\"mw9\")\n",
    "plot(problem.pareto_front(), no_fill=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### MW10"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "problem = get_problem(\"mw10\")\n",
    "plot(problem.pareto_front(), no_fill=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### MW11"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "problem = get_problem(\"mw11\")\n",
    "plot(problem.pareto_front(), no_fill=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### MW12"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "problem = get_problem(\"mw12\")\n",
    "plot(problem.pareto_front(), no_fill=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### MW13"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "problem = get_problem(\"mw13\")\n",
    "plot(problem.pareto_front(), no_fill=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### MW14"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "ref_dirs = get_reference_directions(\"das-dennis\", 3, n_partitions=12)\n",
    "pf = get_problem(\"mw14\").pareto_front()\n",
    "Scatter(angle=(45,45)).add(pf, color=\"red\").show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<sub>Python implementation by [cyrilpic](https://github.com/cyrilpic) based on the [original C++ code](http://www.escience.cn/people/yongwang1/index.html).</sub>"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
